package design.singleton.version01;

public class Singleton {
    //提供静态本类实例
     private static Singleton instance = new Singleton();

     //私有化构造
    private Singleton(){
        System.out.println("Singleton...");
    }

    public static Singleton getInstance(){
        return instance;
    }
}
class TestSingleton{
    public static void main(String[] args) {
        Singleton s1 = Singleton.getInstance();

        Singleton s2 = Singleton.getInstance();

        Singleton s3 = Singleton.getInstance();

        System.out.println(s1 == s2);
    }
}